package com.ruoyi.monitormanage.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.monitormanage.domain.TTestteam;
import com.ruoyi.monitormanage.service.ITTestteamService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * testteambuildController
 * 
 * @author 肖大宝
 * @date 2025-06-10
 */
@RestController
@RequestMapping("/testteam")
public class TTestteamController extends BaseController
{
    @Autowired
    private ITTestteamService tTestteamService;

    /**
     * 查询testteambuild列表
     */
    @RequiresPermissions("monitormanage:testteam:list")
    @GetMapping("/list")
    public TableDataInfo list(TTestteam tTestteam)
    {
        startPage();
        List<TTestteam> list = tTestteamService.selectTTestteamList(tTestteam);
        return getDataTable(list);
    }

    /**
     * 导出testteambuild列表
     */
    @RequiresPermissions("monitormanage:testteam:export")
    @Log(title = "testteambuild", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TTestteam tTestteam)
    {
        List<TTestteam> list = tTestteamService.selectTTestteamList(tTestteam);
        ExcelUtil<TTestteam> util = new ExcelUtil<TTestteam>(TTestteam.class);
        util.exportExcel(response, list, "testteambuild数据");
    }

    /**
     * 获取testteambuild详细信息
     */
    @RequiresPermissions("monitormanage:testteam:query")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(tTestteamService.selectTTestteamById(id));
    }

    /**
     * 新增testteambuild
     */
    @RequiresPermissions("monitormanage:testteam:add")
    @Log(title = "testteambuild", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TTestteam tTestteam)
    {
        return toAjax(tTestteamService.insertTTestteam(tTestteam));
    }

    /**
     * 修改testteambuild
     */
    @RequiresPermissions("monitormanage:testteam:edit")
    @Log(title = "testteambuild", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TTestteam tTestteam)
    {
        return toAjax(tTestteamService.updateTTestteam(tTestteam));
    }

    /**
     * 删除testteambuild
     */
    @RequiresPermissions("monitormanage:testteam:remove")
    @Log(title = "testteambuild", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tTestteamService.deleteTTestteamByIds(ids));
    }
}
